﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5.Ability
{
    public class SampleAbility
    {
        Dictionary<AbilityTrigger, List<Action>> actions=new Dictionary<AbilityTrigger, List<Action>>();

        public void Trigger(AbilityTrigger trigger)
        {
            if (actions.ContainsKey(trigger))
            {
                foreach(var action in actions[trigger])
                {
                    action?.Invoke();
                }
            }
        }
        public void Init()
        {
            actions.Add(AbilityTrigger.Attack, new List<Action>() { Attack });
            actions.Add(AbilityTrigger.UseSkill, new List<Action>() { UseSkill });
        }
        void Attack()
        {
            Console.WriteLine("attack");
        }

        void UseSkill()
        {
            Console.WriteLine("use_skill");
        }
    }
}
